let l1 = [2,4,5]
let l2 = [5,6,4]
var addTwoNumbers = function(l1, l2) {
    let p = 0 , i = 0  
    let len1 = Math.min(l1.length,l2.length)
    let len2 = Math.max(l1.length,l2.length) 
    for(;p<len1;p++){
       l1[p]+=l2[p] 
    }
    while(i<len2){
        if(l1[i]>9){
            l1[i] -= 10
            l1[i+1]++
        }
        if(i=len2-1&&l1[i]>9){
            l1.push(1)
        }
        i++
    }
    return l1
};

let a = addTwoNumbers(l1,l2)
console.log(a);